<#import "/manage/tpl/pageTep.ftl" as page/>
<@page.pageBase currentMenu="商品目录">
	<div id="t1"></div>
	<script>
        BUI.use(['bui/extensions/treegrid'],function (TreeGrid) {
            var data = [
				<#list list as item>
					<#if item.pid=="0">
	                {
	                    id:'${item.id}',
	                    name:'${item.name}',
	                    order1:'${item.order1}',
	                    code:'${item.code}',
	                    showInNav:'${item.showInNav}',
	                    type:'${item.type}',
	                        children:[
								<#list list as children>
									<#if children.pid==item.id>
	                                    {
	                                        id:'${children.id}',
	                                        name:'${children.name}',
	                                        order1:'${children.order1}',
	                                        code:'${children.code}',
	                                        showInNav:'${children.showInNav}',
	                                        type:'${children.type}'
	                                    },
									</#if>
								</#list>
	                        ]
	                },
					</#if>
				</#list>
        	];
	        var tree = new TreeGrid({
	            render : '#t1',
	            nodes : data,
	            columns : [
	                {title : '类别名称',dataIndex :'name',width:'20%'},
	                {title : '顺序',dataIndex : 'order1',width:'20%'},
	                {title : '编码',dataIndex :'code',width:'10%'},
	                {title : '是否在导航条显示',dataIndex :'showInNav',width:'10%'},
	                {title : '商品数量',dataIndex : 'type',width:'20%'},
	                {title : '操作',dataIndex : 'id',width:'20%',renderer:function(data){
	                    return '<a href="${basepath}/manage/catalog/toEdit?id=' + data + '>编辑</a>'
								+'<a  href="${basepath}/manage/catalog/deleteByID?id=' + data + '">删除</a>';
					}}
	            ]
	        });

	        tree.render();
        });
	</script>
</@page.pageBase>